package www.nfin.ya.utils;

import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;

public interface TableInfoExtractUtils {
    Map<String,Map<TableEnum,Object>> tableInfos = new HashMap();
    Map<String,Map<ColumnEnum,Object>> columnInfos = new HashMap();

    public void reload(Connection connection);
     default String getTableComments(String tableName){
        Object o = tableInfos.get(tableName).get(TableEnum.COMMENTS);
        return (String) o;
    }
    default String getColumnComments(String tableName, String columnName){
         try{
             Object o = columnInfos.get(tableName+":"+columnName).get(ColumnEnum.COMMENTS);
             return (String) o;
         }catch (NullPointerException e){
             return "";
         }
    }
    default Map<String,Map<TableEnum,Object>> getTableInfos(){
        return tableInfos;
    }
    default Map<String,Map<ColumnEnum,Object>> getColumnInfos(){
        return columnInfos;
    }
    enum TableEnum{
        COMMENTS;


    }
    enum ColumnEnum{
        COMMENTS;
    }
}

